home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / prog / amisl090.zip / FASTMOUS.ASM < prev    next >
Assembly Source File  |  1992-09-12  |  4KB  |  142 lines

  1. ;-----------------------------------------------------------------------
  2. ; FASTMOUS.ASM    Public Domain 1992 Ralf Brown
  3. ;        You may do with this software whatever you want, but
  4. ;        common courtesy dictates that you not remove my name
  5. ;        from it.
  6. ;
  7. ; Convert slow (on some systems) hardware reset mouse call into a fast
  8. ; software reset call.    This is a demonstration program to show just
  9. ; how small a useful program can be made and still be fully compliant
  10. ; with the alternate multiplex interrupt specification v3.4.  FASTMOUS
  11. ; contains just 128 bytes of resident code and data.
  12. ;
  13. ; Version 0.90
  14. ; LastEdit: 9/12/92
  15. ;-----------------------------------------------------------------------
  16.  
  17. __TINY__ equ 1                ; using Tiny model
  18.     INCLUDE AMIS.MAC
  19.  
  20.     @Startup 2,00            ; need DOS 2.00
  21.                     ; this macro also takes care of declaring
  22.                     ; all the segments in the required order
  23.  
  24. ;-----------------------------------------------------------------------
  25. ;
  26. VERSION_NUM equ 005Ah    ; v0.90
  27. VERSION_STR equ "0.90"
  28.  
  29. ;-----------------------------------------------------------------------
  30. ;
  31. ; useful macros
  32. ;
  33. LODSB_ES MACRO
  34.     DB 26h,0ACh    ; LODSB ES:
  35.     ENDM
  36.  
  37. ;-----------------------------------------------------------------------
  38. ; Put the resident code into its own segment so that all the offsets are
  39. ; proper for the new location after copying it into a UMB or down into
  40. ; the PSP.
  41. ;
  42. TSRcode@
  43.  
  44. ;-----------------------------------------------------------------------
  45. ; Declare the interrupt vectors hooked by the program, then set up the
  46. ; Alternate Multiplex Interrupt Spec handler
  47. ;
  48.     HOOKED_INTS 2Dh,33h        ; it isn't actually necessary to list 2Dh
  49.     ALTMPX    'Ralf B','FASTMOUS',VERSION_NUM
  50.  
  51. ;-----------------------------------------------------------------------
  52. ; Now the meat of the resident portion, the mouse interrupt handler.
  53. ; We can save one byte by specifying the hardware reset handler set up by
  54. ; the ALTMPX macro above
  55. ;
  56.     ISP_HEADER 33h,hw_reset_2Dh
  57.     or    ax,ax            ; hardware reset call?
  58.     jne    use_old_int33        ; skip if not
  59.     push    ds
  60.     mov    ds,ax                 ; DS <- 0000h
  61.     test    byte ptr ds:[417h],13h    ; shift or scroll lock pressed?
  62.     pop    ds
  63.     jnz    use_old_int33        ; skip if yes
  64.     mov    al,21h            ; do software reset instead
  65. use_old_int33:
  66.     jmp    ORIG_INT33h
  67.  
  68. TSRcodeEnd@
  69.  
  70. ;-----------------------------------------------------------------------
  71.  
  72. _TEXT SEGMENT 'CODE'
  73.     ASSUME cs:_TEXT,ds:_INIT,es:TGROUP,ss:NOTHING
  74.  
  75. banner     db 'FASTMOUS v',VERSION_STR,'  Public Domain 1992 Ralf Brown  '
  76.     db '[Type "FASTMOUS R" to remove]',13,10,"$"
  77. installed_msg     db "Installed.",13,10,"$"
  78. already_inst_msg db "Already installed.",13,10,"$"
  79. cant_remove_msg  db "Can't remove from memory.",13,10,"$"
  80. uninstalled_msg  db "Removed.",13,10,"$"
  81.  
  82.  
  83.     @Startup2    Y
  84.     push    ds
  85.     pop    es
  86.     ASSUME    ES:_INIT
  87.     push    cs
  88.     pop    ds
  89.     ASSUME    DS:_TEXT
  90.     ;
  91.     ; say hello
  92.     ;
  93.     DISPLAY_STRING banner
  94.     mov    bx,1000h        ; set memory block to 64K
  95.     mov    ah,4Ah
  96.     int    21h
  97.     mov    si,81h            ; SI -> command line
  98.     cld                ; ensure proper direction for string ops
  99. cmdline_loop:
  100.     lodsb_es
  101.     cmp    al,' '            ; skip blanks and tabs on commandline
  102.     je    cmdline_loop
  103.     cmp    al,9
  104.     je    cmdline_loop
  105.     and    al,0DFh            ; force to uppercase
  106.     cmp    al,'R'
  107.     je    removing
  108. installing:
  109.     ;
  110.     ; place any necessary pre-initialization here
  111.     ;
  112.     INSTALL_TSR ,BEST,TOPMEM,inst_notify,already_installed
  113.  
  114. removing:
  115.     UNINSTALL cant_uninstall
  116.     push    cs
  117.     pop    ds
  118.     ASSUME    DS:_TEXT
  119.     DISPLAY_STRING uninstalled_msg
  120.         mov     ax,4C00h
  121.     int    21h
  122.  
  123. cant_uninstall:
  124.     mov    dx,offset _TEXT:cant_remove_msg
  125.     jmp short exit_with_error
  126. already_installed:
  127.     mov    dx,offset _TEXT:already_inst_msg
  128. exit_with_error:
  129.     mov    ah,9
  130.     int    21h
  131.     mov    ax,4C01h
  132.     int    21h
  133.  
  134. inst_notify:
  135.     DISPLAY_STRING installed_msg
  136.     ret
  137.  
  138. _TEXT ENDS
  139.  
  140.      end INIT
  141.  
  142.